home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / mail.vim < prev    next >
Encoding:
Text File  |  2001-06-29  |  2.7 KB  |  76 lines

  1. " Vim syntax file
  2. " Language:    Mail file
  3. " Maintainer:    Felix von Leitner <leitner@math.fu-berlin.de>
  4. " Last Change:    2001 Jun 28
  5.  
  6. " For version 5.x: Clear all syntax items
  7. " For version 6.x: Quit when a syntax file was already loaded
  8. if version < 600
  9.   syntax clear
  10. elseif exists("b:current_syntax")
  11.   finish
  12. endif
  13.  
  14. " The mail header is recognized starting with a "keyword:" line and ending
  15. " with an empty line or other line that can't be in the header.
  16. " All lines of the header are highlighted
  17. " For "From " matching case is required, not for the rest.
  18. syn region    mailHeader    start="^From " skip="^[ \t]" end="^[-A-Za-z0-9/]*[^-A-Za-z0-9/:]"me=s-1 end="^[^:]*$"me=s-1 end="^---*" contains=mailHeaderKey,mailSubject
  19.  
  20. syn case ignore
  21.  
  22. syn region    mailHeader    start="^\(Newsgroups:\|From:\|To:\|Cc:\|Bcc:\|Reply-To:\|Subject:\|Return-Path:\|Received:\|Date:\|Replied:\)" skip="^[ \t]" end="^[-a-z0-9/]*[^-a-z0-9/:]"me=s-1 end="^[^:]*$"me=s-1 end="^---*" contains=mailHeaderKey,mailSubject
  23.  
  24. syn region    mailHeaderKey    contained start="^\(From\|To\|Cc\|Bcc\|Reply-To\).*" skip=",$" end="$" contains=mailEmail
  25. syn match    mailHeaderKey    contained "^Date"
  26.  
  27. syn match    mailSubject    contained "^Subject.*"
  28.  
  29. syn match    mailEmail    contained "[_=a-z\./+A-Z0-9-]\+@[a-zA-Z0-9\./\-]\+"
  30. syn match    mailEmail    contained "<.\{-}>"
  31.  
  32. syn region    mailSignature    start="^-- *$" end="^$"
  33.  
  34. " even and odd quoted lines
  35. " removed ':', it caused too many bogus highlighting
  36. " order is imporant here!
  37. syn match    mailQuoted1    "^\([A-Za-z]\+>\|[]|}>]\).*$"
  38. syn match    mailQuoted2    "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{2}.*$"
  39. syn match    mailQuoted3    "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{3}.*$"
  40. syn match    mailQuoted4    "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{4}.*$"
  41. syn match    mailQuoted5    "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{5}.*$"
  42. syn match    mailQuoted6    "^\(\([A-Za-z]\+>\|[]|}>]\)[ \t]*\)\{6}.*$"
  43.  
  44. " Need to sync on the header.  Assume we can do that within a hundred lines
  45. syn sync lines=100
  46.  
  47. " Define the default highlighting.
  48. " For version 5.7 and earlier: only when not done already
  49. " For version 5.8 and later: only when an item doesn't have highlighting yet
  50. if version >= 508 || !exists("did_ahdl_syn_inits")
  51.   if version < 508
  52.     let did_ahdl_syn_inits = 1
  53.     command -nargs=+ HiLink hi link <args>
  54.   else
  55.     command -nargs=+ HiLink hi def link <args>
  56.   endif
  57.  
  58.   HiLink mailHeaderKey        Type
  59.   HiLink mailHeader        Statement
  60.   HiLink mailQuoted1        Comment
  61.   HiLink mailQuoted3        Comment
  62.   HiLink mailQuoted5        Comment
  63.   HiLink mailQuoted2        Identifier
  64.   HiLink mailQuoted4        Identifier
  65.   HiLink mailQuoted6        Identifier
  66.   HiLink mailSignature        PreProc
  67.   HiLink mailEmail        Special
  68.   HiLink mailSubject        String
  69.  
  70.   delcommand HiLink
  71. endif
  72.  
  73. let b:current_syntax = "mail"
  74.  
  75. " vim: ts=8
  76.